home *** CD-ROM | disk | FTP | other *** search
/ An Invitation to the Roland World of Music / Roland - An Invitation To The Roland World Of Music.bin / vb / cooltool / filter / filter.frm next >
Text File  |  1995-04-20  |  28KB  |  868 lines

  1. VERSION 2.00
  2. Begin Form FormFilter 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "MIDI In Filtering"
  6.    Height          =   7140
  7.    Icon            =   FILTER.FRX:0000
  8.    Left            =   1950
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   6735
  12.    ScaleWidth      =   5010
  13.    Top             =   90
  14.    Width           =   5130
  15.    Begin MIDIOutput MIDIOutput1 
  16.       DeviceID        =   0
  17.       Left            =   2250
  18.       Top             =   0
  19.       VolumeLeft      =   0
  20.       VolumeRight     =   0
  21.    End
  22.    Begin MIDIInput MIDIInput1 
  23.       DeviceID        =   0
  24.       Left            =   2310
  25.       MaxSysexSize    =   0
  26.       MessageEventEnable=   -1  'True
  27.       Top             =   1170
  28.    End
  29.    Begin Frame Frame7 
  30.       BackColor       =   &H00C0C0C0&
  31.       Caption         =   "MIDI Channel"
  32.       Height          =   2385
  33.       Left            =   90
  34.       TabIndex        =   32
  35.       Top             =   3480
  36.       Width           =   2415
  37.       Begin Knob Knob1 
  38.          BackColor       =   &H00C0C0C0&
  39.          BevelWidth      =   3
  40.          BorderWidth     =   2
  41.          FontBold        =   0   'False
  42.          FontItalic      =   0   'False
  43.          FontName        =   "Small Fonts"
  44.          FontSize        =   6.75
  45.          FontStrikethru  =   0   'False
  46.          FontUnderline   =   0   'False
  47.          Height          =   1845
  48.          Indicator       =   1  'Line
  49.          IndicatorColor  =   &H00FFFFFF&
  50.          IndicatorWidth  =   1
  51.          KnobColor       =   &H00404040&
  52.          KnobStyle       =   1  'Raised
  53.          Left            =   180
  54.          LinkControl     =   ""
  55.          LinkProperty    =   ""
  56.          Max             =   15
  57.          Min             =   0
  58.          Radius          =   525
  59.          TickCaptionColor=   &H00000000&
  60.          TickCaptions    =   FILTER.FRX:0302
  61.          TickColor       =   &H00FFFFFF&
  62.          TickCount       =   16
  63.          TickGap         =   3
  64.          TickLength      =   9
  65.          TickWidth       =   1
  66.          Top             =   360
  67.          Value           =   0
  68.          Width           =   2085
  69.       End
  70.    End
  71.    Begin Frame Frame6 
  72.       BackColor       =   &H00C0C0C0&
  73.       Caption         =   "Channel Filtering"
  74.       ForeColor       =   &H00000000&
  75.       Height          =   2055
  76.       Left            =   90
  77.       TabIndex        =   24
  78.       Top             =   1410
  79.       Width           =   2415
  80.       Begin CheckBox CheckMIDIFilterChannel 
  81.          BackColor       =   &H00C0C0C0&
  82.          Caption         =   "Pitch Bend"
  83.          FontBold        =   0   'False
  84.          FontItalic      =   0   'False
  85.          FontName        =   "MS Sans Serif"
  86.          FontSize        =   8.25
  87.          FontStrikethru  =   0   'False
  88.          FontUnderline   =   0   'False
  89.          ForeColor       =   &H00000000&
  90.          Height          =   225
  91.          Index           =   6
  92.          Left            =   330
  93.          TabIndex        =   31
  94.          Top             =   1710
  95.          Width           =   1605
  96.       End
  97.       Begin CheckBox CheckMIDIFilterChannel 
  98.          BackColor       =   &H00C0C0C0&
  99.          Caption         =   "Channel Pressure"
  100.          FontBold        =   0   'False
  101.          FontItalic      =   0   'False
  102.          FontName        =   "MS Sans Serif"
  103.          FontSize        =   8.25
  104.          FontStrikethru  =   0   'False
  105.          FontUnderline   =   0   'False
  106.          ForeColor       =   &H00000000&
  107.          Height          =   225
  108.          Index           =   5
  109.          Left            =   330
  110.          TabIndex        =   30
  111.          Top             =   1470
  112.          Width           =   1605
  113.       End
  114.       Begin CheckBox CheckMIDIFilterChannel 
  115.          BackColor       =   &H00C0C0C0&
  116.          Caption         =   "Note On"
  117.          FontBold        =   0   'False
  118.          FontItalic      =   0   'False
  119.          FontName        =   "MS Sans Serif"
  120.          FontSize        =   8.25
  121.          FontStrikethru  =   0   'False
  122.          FontUnderline   =   0   'False
  123.          ForeColor       =   &H00000000&
  124.          Height          =   225
  125.          Index           =   0
  126.          Left            =   330
  127.          TabIndex        =   29
  128.          Top             =   270
  129.          Width           =   1425
  130.       End
  131.       Begin CheckBox CheckMIDIFilterChannel 
  132.          BackColor       =   &H00C0C0C0&
  133.          Caption         =   "Note Off"
  134.          FontBold        =   0   'False
  135.          FontItalic      =   0   'False
  136.          FontName        =   "MS Sans Serif"
  137.          FontSize        =   8.25
  138.          FontStrikethru  =   0   'False
  139.          FontUnderline   =   0   'False
  140.          ForeColor       =   &H00000000&
  141.          Height          =   225
  142.          Index           =   1
  143.          Left            =   330
  144.          TabIndex        =   28
  145.          Top             =   510
  146.          Width           =   1425
  147.       End
  148.       Begin CheckBox CheckMIDIFilterChannel 
  149.          BackColor       =   &H00C0C0C0&
  150.          Caption         =   "Key Pressure"
  151.          FontBold        =   0   'False
  152.          FontItalic      =   0   'False
  153.          FontName        =   "MS Sans Serif"
  154.          FontSize        =   8.25
  155.          FontStrikethru  =   0   'False
  156.          FontUnderline   =   0   'False
  157.          ForeColor       =   &H00000000&
  158.          Height          =   225
  159.          Index           =   2
  160.          Left            =   330
  161.          TabIndex        =   27
  162.          Top             =   750
  163.          Width           =   1425
  164.       End
  165.       Begin CheckBox CheckMIDIFilterChannel 
  166.          BackColor       =   &H00C0C0C0&
  167.          Caption         =   "Control Change"
  168.          FontBold        =   0   'False
  169.          FontItalic      =   0   'False
  170.          FontName        =   "MS Sans Serif"
  171.          FontSize        =   8.25
  172.          FontStrikethru  =   0   'False
  173.          FontUnderline   =   0   'False
  174.          ForeColor       =   &H00000000&
  175.          Height          =   225
  176.          Index           =   3
  177.          Left            =   330
  178.          TabIndex        =   26
  179.          Top             =   990
  180.          Width           =   1425
  181.       End
  182.       Begin CheckBox CheckMIDIFilterChannel 
  183.          BackColor       =   &H00C0C0C0&
  184.          Caption         =   "Program Change"
  185.          FontBold        =   0   'False
  186.          FontItalic      =   0   'False
  187.          FontName        =   "MS Sans Serif"
  188.          FontSize        =   8.25
  189.          FontStrikethru  =   0   'False
  190.          FontUnderline   =   0   'False
  191.          ForeColor       =   &H00000000&
  192.          Height          =   225
  193.          Index           =   4
  194.          Left            =   330
  195.          TabIndex        =   25
  196.          Top             =   1230
  197.          Width           =   1605
  198.       End
  199.    End
  200.    Begin Frame Frame5 
  201.       BackColor       =   &H00C0C0C0&
  202.       Caption         =   "Real-Time Filtering"
  203.       Height          =   2385
  204.       Left            =   2550
  205.       TabIndex        =   15
  206.       Top             =   3480
  207.       Width           =   2415
  208.       Begin CheckBox CheckMIDIFilterReal 
  209.          BackColor       =   &H00C0C0C0&
  210.          Caption         =   "MIDI Continue"
  211.          FontBold        =   0   'False
  212.          FontItalic      =   0   'False
  213.          FontName        =   "MS Sans Serif"
  214.          FontSize        =   8.25
  215.          FontStrikethru  =   0   'False
  216.          FontUnderline   =   0   'False
  217.          Height          =   225
  218.          Index           =   3
  219.          Left            =   150
  220.          TabIndex        =   23
  221.          Top             =   1050
  222.          Width           =   1575
  223.       End
  224.       Begin CheckBox CheckMIDIFilterReal 
  225.          BackColor       =   &H00C0C0C0&
  226.          Caption         =   "MIDI Stop"
  227.          FontBold        =   0   'False
  228.          FontItalic      =   0   'False
  229.          FontName        =   "MS Sans Serif"
  230.          FontSize        =   8.25
  231.          FontStrikethru  =   0   'False
  232.          FontUnderline   =   0   'False
  233.          Height          =   225
  234.          Index           =   4
  235.          Left            =   150
  236.          TabIndex        =   22
  237.          Top             =   1290
  238.          Width           =   1635
  239.       End
  240.       Begin CheckBox CheckMIDIFilterReal 
  241.          BackColor       =   &H00C0C0C0&
  242.          Caption         =   "Undefined"
  243.          FontBold        =   0   'False
  244.          FontItalic      =   0   'False
  245.          FontName        =   "MS Sans Serif"
  246.          FontSize        =   8.25
  247.          FontStrikethru  =   0   'False
  248.          FontUnderline   =   0   'False
  249.          Height          =   225
  250.          Index           =   5
  251.          Left            =   150
  252.          TabIndex        =   21
  253.          Top             =   1530
  254.          Width           =   1425
  255.       End
  256.       Begin CheckBox CheckMIDIFilterReal 
  257.          BackColor       =   &H00C0C0C0&
  258.          Caption         =   "Active Sensing"
  259.          FontBold        =   0   'False
  260.          FontItalic      =   0   'False
  261.          FontName        =   "MS Sans Serif"
  262.          FontSize        =   8.25
  263.          FontStrikethru  =   0   'False
  264.          FontUnderline   =   0   'False
  265.          Height          =   225
  266.          Index           =   6
  267.          Left            =   150
  268.          TabIndex        =   20
  269.          Top             =   1770
  270.          Width           =   1425
  271.       End
  272.       Begin CheckBox CheckMIDIFilterReal 
  273.          BackColor       =   &H00C0C0C0&
  274.          Caption         =   "System Reset"
  275.          FontBold        =   0   'False
  276.          FontItalic      =   0   'False
  277.          FontName        =   "MS Sans Serif"
  278.          FontSize        =   8.25
  279.          FontStrikethru  =   0   'False
  280.          FontUnderline   =   0   'False
  281.          Height          =   225
  282.          Index           =   7
  283.          Left            =   150
  284.          TabIndex        =   19
  285.          Top             =   2010
  286.          Width           =   1425
  287.       End
  288.       Begin CheckBox CheckMIDIFilterReal 
  289.          BackColor       =   &H00C0C0C0&
  290.          Caption         =   "MIDI Clock"
  291.          FontBold        =   0   'False
  292.          FontItalic      =   0   'False
  293.          FontName        =   "MS Sans Serif"
  294.          FontSize        =   8.25
  295.          FontStrikethru  =   0   'False
  296.          FontUnderline   =   0   'False
  297.          Height          =   225
  298.          Index           =   0
  299.          Left            =   150
  300.          TabIndex        =   18
  301.          Top             =   330
  302.          Width           =   1425
  303.       End
  304.       Begin CheckBox CheckMIDIFilterReal 
  305.          BackColor       =   &H00C0C0C0&
  306.          Caption         =   "Undefined"
  307.          FontBold        =   0   'False
  308.          FontItalic      =   0   'False
  309.          FontName        =   "MS Sans Serif"
  310.          FontSize        =   8.25
  311.          FontStrikethru  =   0   'False
  312.          FontUnderline   =   0   'False
  313.          Height          =   225
  314.          Index           =   1
  315.          Left            =   150
  316.          TabIndex        =   17
  317.          Top             =   570
  318.          Width           =   1425
  319.       End
  320.       Begin CheckBox CheckMIDIFilterReal 
  321.          BackColor       =   &H00C0C0C0&
  322.          Caption         =   "MIDI Start"
  323.          FontBold        =   0   'False
  324.          FontItalic      =   0   'False
  325.          FontName        =   "MS Sans Serif"
  326.          FontSize        =   8.25
  327.          FontStrikethru  =   0   'False
  328.          FontUnderline   =   0   'False
  329.          Height          =   225
  330.          Index           =   2
  331.          Left            =   150
  332.          TabIndex        =   16
  333.          Top             =   810
  334.          Width           =   1425
  335.       End
  336.    End
  337.    Begin Frame Frame4 
  338.       BackColor       =   &H00C0C0C0&
  339.       Caption         =   "Queued MIDI Messages"
  340.       Height          =   585
  341.       Left            =   60
  342.       TabIndex        =   7
  343.       Top             =   750
  344.       Width           =   4905
  345.       Begin Label LblInQueueCount 
  346.          Alignment       =   2  'Center
  347.          BackColor       =   &H00000000&
  348.          Caption         =   "MIDI In Queue Count"
  349.          FontBold        =   0   'False
  350.          FontItalic      =   0   'False
  351.          FontName        =   "MS Sans Serif"
  352.          FontSize        =   8.25
  353.          FontStrikethru  =   0   'False
  354.          FontUnderline   =   0   'False
  355.          ForeColor       =   &H0000FF00&
  356.          Height          =   225
  357.          Left            =   90
  358.          TabIndex        =   9
  359.          Top             =   270
  360.          Width           =   4755
  361.       End
  362.    End
  363.    Begin Frame Frame3 
  364.       BackColor       =   &H00C0C0C0&
  365.       Caption         =   "MIDI Message"
  366.       Height          =   585
  367.       Left            =   60
  368.       TabIndex        =   6
  369.       Top             =   120
  370.       Width           =   4905
  371.       Begin Label LblMidiMessage 
  372.          Alignment       =   2  'Center
  373.          BackColor       =   &H00000000&
  374.          Caption         =   "MIDI Message"
  375.          FontBold        =   0   'False
  376.          FontItalic      =   0   'False
  377.          FontName        =   "MS Sans Serif"
  378.          FontSize        =   8.25
  379.          FontStrikethru  =   0   'False
  380.          FontUnderline   =   0   'False
  381.          ForeColor       =   &H0000FF00&
  382.          Height          =   225
  383.          Left            =   90
  384.          TabIndex        =   8
  385.          Top             =   270
  386.          Width           =   4755
  387.       End
  388.    End
  389.    Begin Frame Frame2 
  390.       BackColor       =   &H00C0C0C0&
  391.       Caption         =   "MIDI Filtering"
  392.       Height          =   2055
  393.       Left            =   2550
  394.       TabIndex        =   4
  395.       Top             =   1410
  396.       Width           =   2415
  397.       Begin CheckBox CheckMIDIFilter 
  398.          BackColor       =   &H00C0C0C0&
  399.          Caption         =   "Tune Request"
  400.          FontBold        =   0   'False
  401.          FontItalic      =   0   'False
  402.          FontName        =   "MS Sans Serif"
  403.          FontSize        =   8.25
  404.          FontStrikethru  =   0   'False
  405.          FontUnderline   =   0   'False
  406.          Height          =   225
  407.          Index           =   5
  408.          Left            =   120
  409.          TabIndex        =   14
  410.          Top             =   1500
  411.          Width           =   1425
  412.       End
  413.       Begin CheckBox CheckMIDIFilter 
  414.          BackColor       =   &H00C0C0C0&
  415.          Caption         =   "Undefined xF5"
  416.          FontBold        =   0   'False
  417.          FontItalic      =   0   'False
  418.          FontName        =   "MS Sans Serif"
  419.          FontSize        =   8.25
  420.          FontStrikethru  =   0   'False
  421.          FontUnderline   =   0   'False
  422.          Height          =   225
  423.          Index           =   4
  424.          Left            =   120
  425.          TabIndex        =   13
  426.          Top             =   1260
  427.          Width           =   1425
  428.       End
  429.       Begin CheckBox CheckMIDIFilter 
  430.          BackColor       =   &H00C0C0C0&
  431.          Caption         =   "Undefined xF4"
  432.          FontBold        =   0   'False
  433.          FontItalic      =   0   'False
  434.          FontName        =   "MS Sans Serif"
  435.          FontSize        =   8.25
  436.          FontStrikethru  =   0   'False
  437.          FontUnderline   =   0   'False
  438.          Height          =   225
  439.          Index           =   3
  440.          Left            =   120
  441.          TabIndex        =   12
  442.          Top             =   1020
  443.          Width           =   1425
  444.       End
  445.       Begin CheckBox CheckMIDIFilter 
  446.          BackColor       =   &H00C0C0C0&
  447.          Caption         =   "Song Select"
  448.          FontBold        =   0   'False
  449.          FontItalic      =   0   'False
  450.          FontName        =   "MS Sans Serif"
  451.          FontSize        =   8.25
  452.          FontStrikethru  =   0   'False
  453.          FontUnderline   =   0   'False
  454.          Height          =   225
  455.          Index           =   2
  456.          Left            =   120
  457.          TabIndex        =   11
  458.          Top             =   780
  459.          Width           =   1425
  460.       End
  461.       Begin CheckBox CheckMIDIFilter 
  462.          BackColor       =   &H00C0C0C0&
  463.          Caption         =   "Song Position Pointer"
  464.          FontBold        =   0   'False
  465.          FontItalic      =   0   'False
  466.          FontName        =   "MS Sans Serif"
  467.          FontSize        =   8.25
  468.          FontStrikethru  =   0   'False
  469.          FontUnderline   =   0   'False
  470.          Height          =   225
  471.          Index           =   1
  472.          Left            =   120
  473.          TabIndex        =   10
  474.          Top             =   540
  475.          Width           =   1935
  476.       End
  477.       Begin CheckBox CheckMIDIFilter 
  478.          BackColor       =   &H00C0C0C0&
  479.          Caption         =   "MIDI Time Code"
  480.          FontBold        =   0   'False
  481.          FontItalic      =   0   'False
  482.          FontName        =   "MS Sans Serif"
  483.          FontSize        =   8.25
  484.          FontStrikethru  =   0   'False
  485.          FontUnderline   =   0   'False
  486.          Height          =   225
  487.          Index           =   0
  488.          Left            =   120
  489.          TabIndex        =   5
  490.          Top             =   300
  491.          Width           =   1755
  492.       End
  493.    End
  494.    Begin Frame Frame1 
  495.       BackColor       =   &H00C0C0C0&
  496.       Caption         =   "MIDI Out"
  497.       Height          =   675
  498.       Left            =   2550
  499.       TabIndex        =   2
  500.       Top             =   5940
  501.       Width           =   2415
  502.       Begin ComboBox Combo1 
  503.          Height          =   300
  504.          Left            =   120
  505.          Style           =   2  'Dropdown List
  506.          TabIndex        =   3
  507.          Top             =   270
  508.          Width           =   2205
  509.       End
  510.    End
  511.    Begin Frame FrameMidiIn 
  512.       BackColor       =   &H00C0C0C0&
  513.       Caption         =   "MIDI In"
  514.       Height          =   675
  515.       Left            =   90
  516.       TabIndex        =   0
  517.       Top             =   5940
  518.       Width           =   2415
  519.       Begin ComboBox Combo2 
  520.          Height          =   300
  521.          Left            =   120
  522.          Style           =   2  'Dropdown List
  523.          TabIndex        =   1
  524.          Top             =   270
  525.          Width           =   2205
  526.       End
  527.    End
  528. End
  529.  
  530. Option Explicit
  531.  
  532. '
  533. ' This FILTER example program was developed to show the types of
  534. ' MIDI message filtering that can be done with MIDI CoolTools.
  535. '
  536. ' Remember that Channel Filtering is MIDI Channel specific.  Example:
  537. ' You could filter note off events on MIDI Channel 2, but allow them
  538. ' to not be filter on MIDI Channel 1
  539.  
  540. ' MIDIInput1.Filter(NOTE_OFF + Channel1) = False
  541. ' MIDIInput1.Filter(NOTE_OFF + Channel2) = True
  542. '
  543. '
  544. ' Look in the MIDCONST.BAS for MIDI filtering constants
  545. '
  546.  
  547. Sub CheckMIDIFilter_Click (index As Integer)
  548.  
  549.     Select Case index
  550.     Case Is = 0
  551.         If CheckMIDIFilter(index).Value = 0 Then
  552.         MIDIInput1.Filter(FILTER_MTC) = False
  553.         Else
  554.         MIDIInput1.Filter(FILTER_MTC) = True
  555.         End If
  556.     Case Is = 1
  557.         If CheckMIDIFilter(index).Value = 0 Then
  558.         MIDIInput1.Filter(FILTER_SNGPTR) = False
  559.         Else
  560.         MIDIInput1.Filter(FILTER_SNGPTR) = True
  561.         End If
  562.     Case Is = 2
  563.         If CheckMIDIFilter(index).Value = 0 Then
  564.         MIDIInput1.Filter(FILTER_SNGSEL) = False
  565.         Else
  566.         MIDIInput1.Filter(FILTER_SNGSEL) = True
  567.         End If
  568.     Case Is = 3
  569.         If CheckMIDIFilter(index).Value = 0 Then
  570.         MIDIInput1.Filter(FILTER_F4) = False
  571.         Else
  572.         MIDIInput1.Filter(FILTER_F4) = True
  573.         End If
  574.     Case Is = 4
  575.         If CheckMIDIFilter(index).Value = 0 Then
  576.         MIDIInput1.Filter(FILTER_F5) = False
  577.         Else
  578.         MIDIInput1.Filter(FILTER_F5) = True
  579.         End If
  580.     Case Is = 5
  581.         If CheckMIDIFilter(index).Value = 0 Then
  582.         MIDIInput1.Filter(FILTER_TUNE) = False
  583.         Else
  584.         MIDIInput1.Filter(FILTER_TUNE) = True
  585.         End If
  586.     End Select
  587. End Sub
  588.  
  589. Sub CheckMIDIFilter1_Click (Value As Integer)
  590.     If Value = 0 Then
  591.     MIDIInput1.Filter(FILTER_F9) = False
  592.     Else
  593.     MIDIInput1.Filter(FILTER_F9) = True
  594.     End If
  595. End Sub
  596.  
  597. Sub CheckMIDIFilter2_Click (Value As Integer)
  598.     If Value = 0 Then
  599.     MIDIInput1.Filter(FILTER_ACTIVE_SENSE) = False
  600.     Else
  601.     MIDIInput1.Filter(FILTER_ACTIVE_SENSE) = True
  602.     End If
  603. End Sub
  604.  
  605. Sub CheckMIDIFilter3_Click (Value As Integer)
  606.     If Value = 0 Then
  607.     MIDIInput1.Filter(FILTER_CLOCK) = False
  608.     Else
  609.     MIDIInput1.Filter(FILTER_CLOCK) = True
  610.     End If
  611. End Sub
  612.  
  613. Sub CheckMIDIFilterChannel_Click (index As Integer)
  614.     Select Case index
  615.     Case Is = 0
  616.         If CheckMIDIFilterChannel(index).Value = 0 Then
  617.         MIDIInput1.Filter(NOTE_ON + Knob1.Value) = False
  618.         Else
  619.         MIDIInput1.Filter(NOTE_ON + Knob1.Value) = True
  620.         End If
  621.     Case Is = 1
  622.         If CheckMIDIFilterChannel(index).Value = 0 Then
  623.         MIDIInput1.Filter(NOTE_OFF + Knob1.Value) = False
  624.         Else
  625.         MIDIInput1.Filter(NOTE_OFF + Knob1.Value) = True
  626.         End If
  627.     Case Is = 2
  628.         If CheckMIDIFilterChannel(index).Value = 0 Then
  629.         MIDIInput1.Filter(POLY_KEY_PRESS + Knob1.Value) = False
  630.         Else
  631.         MIDIInput1.Filter(POLY_KEY_PRESS + Knob1.Value) = True
  632.         End If
  633.     Case Is = 3
  634.         If CheckMIDIFilterChannel(index).Value = 0 Then
  635.         MIDIInput1.Filter(CONTROLLER_CHANGE + Knob1.Value) = False
  636.         Else
  637.         MIDIInput1.Filter(CONTROLLER_CHANGE + Knob1.Value) = True
  638.         End If
  639.     Case Is = 4
  640.         If CheckMIDIFilterChannel(index).Value = 0 Then
  641.         MIDIInput1.Filter(PROGRAM_CHANGE + Knob1.Value) = False
  642.         Else
  643.         MIDIInput1.Filter(PROGRAM_CHANGE + Knob1.Value) = True
  644.         End If
  645.     Case Is = 5
  646.         If CheckMIDIFilterChannel(index).Value = 0 Then
  647.         MIDIInput1.Filter(CHANNEL_PRESSURE + Knob1.Value) = False
  648.         Else
  649.         MIDIInput1.Filter(CHANNEL_PRESSURE + Knob1.Value) = True
  650.         End If
  651.     Case Is = 6
  652.         If CheckMIDIFilterChannel(index).Value = 0 Then
  653.         MIDIInput1.Filter(PITCH_BEND + Knob1.Value) = False
  654.         Else
  655.         MIDIInput1.Filter(PITCH_BEND + Knob1.Value) = True
  656.         End If
  657.     End Select
  658. End Sub
  659.  
  660. Sub CheckMIDIFilterReal_Click (index As Integer)
  661.     Select Case index
  662.     Case Is = 0
  663.         If CheckMIDIFilterReal(index).Value = 0 Then
  664.         MIDIInput1.Filter(FILTER_CLOCK) = False
  665.         Else
  666.         MIDIInput1.Filter(FILTER_CLOCK) = True
  667.         End If
  668.     Case Is = 1
  669.         If CheckMIDIFilterReal(index).Value = 0 Then
  670.         MIDIInput1.Filter(FILTER_F9) = False
  671.         Else
  672.         MIDIInput1.Filter(FILTER_F9) = True
  673.         End If
  674.     Case Is = 2
  675.         If CheckMIDIFilterReal(index).Value = 0 Then
  676.         MIDIInput1.Filter(FILTER_START) = False
  677.         Else
  678.         MIDIInput1.Filter(FILTER_START) = True
  679.         End If
  680.     Case Is = 3
  681.         If CheckMIDIFilterReal(index).Value = 0 Then
  682.         MIDIInput1.Filter(FILTER_CONT) = False
  683.         Else
  684.         MIDIInput1.Filter(FILTER_CONT) = True
  685.         End If
  686.     Case Is = 4
  687.         If CheckMIDIFilterReal(index).Value = 0 Then
  688.         MIDIInput1.Filter(FILTER_STOP) = False
  689.         Else
  690.         MIDIInput1.Filter(FILTER_STOP) = True
  691.         End If
  692.     Case Is = 5
  693.         If CheckMIDIFilterReal(index).Value = 0 Then
  694.         MIDIInput1.Filter(FILTER_FD) = False
  695.         Else
  696.         MIDIInput1.Filter(FILTER_FD) = True
  697.         End If
  698.     Case Is = 6
  699.         If CheckMIDIFilterReal(index).Value = 0 Then
  700.         MIDIInput1.Filter(FILTER_ACTIVE_SENSE) = False
  701.         Else
  702.         MIDIInput1.Filter(FILTER_ACTIVE_SENSE) = True
  703.         End If
  704.     Case Is = 7
  705.         If CheckMIDIFilterReal(index).Value = 0 Then
  706.         MIDIInput1.Filter(FILTER_RESET) = False
  707.         Else
  708.         MIDIInput1.Filter(FILTER_RESET) = True
  709.         End If
  710.     End Select
  711. End Sub
  712.  
  713. Sub Combo1_Click ()
  714.     Dim wRtn As Integer
  715.  
  716.     
  717.     ' Close
  718.     MIDIOutput1.Action = MIDIOUT_CLOSE
  719.     
  720.     ' Open selected device
  721.     MIDIOutput1.DeviceID = Combo1.ListIndex - 1
  722.     MIDIOutput1.Action = MIDIOUT_OPEN
  723. End Sub
  724.  
  725. Sub Combo2_Click ()
  726.     Dim wRtn As Integer
  727.     
  728.     If MIDIInput1.State >= MIDISTATE_OPEN Then
  729.     ' Close midiin port
  730.     MIDIInput1.Action = MIDIIN_CLOSE
  731.     End If
  732.  
  733.     
  734.     ' Get selected device id
  735.     MIDIInput1.DeviceID = Combo2.ListIndex
  736.     
  737.     ' Open and display handle
  738.     MIDIInput1.Action = MIDIIN_OPEN
  739.     MIDIInput1.Action = MIDIIN_START
  740. End Sub
  741.  
  742. Sub Form_Load ()
  743.     Dim i As Integer
  744.  
  745.     ' Center the form on the screen
  746.     'Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  747.  
  748.     '
  749.     ' Fill output device combo box
  750.     '
  751.     For i = -1 To MIDIOutput1.DeviceCount - 1
  752.     MIDIOutput1.DeviceID = i
  753.     Combo1.AddItem MIDIOutput1.ProductName
  754.     Next
  755.     '
  756.     ' Select first in list
  757.     '
  758.     Combo1.ListIndex = 0
  759.     MIDIOutput1.DeviceID = -1
  760.     '
  761.     ' Fill input device combo box
  762.     '
  763.     For i = 0 To MIDIInput1.DeviceCount - 1
  764.     MIDIInput1.DeviceID = i
  765.     Combo2.AddItem MIDIInput1.ProductName
  766.     Next
  767.     '
  768.     ' Select first in list
  769.     '
  770.     Combo2.ListIndex = 0
  771.     MIDIInput1.DeviceID = 0
  772. End Sub
  773.  
  774. Sub Form_Unload (Cancel As Integer)
  775.     MIDIInput1.Action = MIDIIN_STOP
  776.     
  777.     ' Close midiin port
  778.     MIDIInput1.Action = MIDIIN_CLOSE
  779.     
  780.     ' Close
  781.     MIDIOutput1.Action = MIDIOUT_CLOSE
  782. End Sub
  783.  
  784. Sub Knob1_Change ()
  785. Dim index As Integer
  786.     
  787.     '
  788.     'Turn off all Filter on this channel
  789.     '
  790.     For index = 0 To 6
  791.     CheckMIDIFilterChannel(index).Value = 0
  792.     MIDIInput1.Filter(NOTE_ON + Knob1.Value) = False
  793.     MIDIInput1.Filter(NOTE_OFF + Knob1.Value) = False
  794.     MIDIInput1.Filter(POLY_KEY_PRESS + Knob1.Value) = False
  795.     MIDIInput1.Filter(CONTROLLER_CHANGE + Knob1.Value) = False
  796.     MIDIInput1.Filter(PROGRAM_CHANGE + Knob1.Value) = False
  797.     MIDIInput1.Filter(CHANNEL_PRESSURE + Knob1.Value) = False
  798.     MIDIInput1.Filter(PITCH_BEND + Knob1.Value) = False
  799.     Next
  800. End Sub
  801.  
  802. Sub MIDIInput1_Error (ErrorCode As Integer, ErrorMessage As String)
  803.     '
  804.     ' Midi input error, display message
  805.     '
  806.     MsgBox ErrorMessage
  807.  
  808. End Sub
  809.  
  810. Sub MIDIInput1_Message ()
  811.     '
  812.     ' Show incoming data on screen
  813.     ' Labels in VB 3.0 are very slow in updating/repainting,
  814.     ' at least in terms of real-time.  If you using a label REFRESH
  815.     ' method you will experience some time delay.
  816.     '
  817.     ' Generally, painting of a label control is handled automatically
  818.     ' by VB while no events are occurring.  So if you try to force
  819.     ' VB to repaint a label control immediately, you will be taking
  820.     '
  821.     LblMidiMessage.Caption = Str(MIDIInput1.Message) & Str(MIDIInput1.Data1) & Str(MIDIInput1.Data2)
  822.  
  823.     '
  824.     'This do while loop allows you to take all the messages that are
  825.     'waiting in the message queue.
  826.     '
  827.     Do While MIDIInput1.MessageCount > 0
  828.     '
  829.     'This is the incoming MIDI data
  830.     '
  831.     MIDIOutput1.Message = MIDIInput1.Message
  832.     MIDIOutput1.Data1 = MIDIInput1.Data1
  833.     MIDIOutput1.Data2 = MIDIInput1.Data2
  834.     MIDIOutput1.Time = 0
  835.  
  836.     '
  837.     ' Display number of queued MIDI In messages
  838.     '
  839.     LblInQueueCount.Caption = MIDIInput1.MessageCount
  840.     LblInQueueCount.Refresh
  841.  
  842.     
  843.     '
  844.     'Send MIDI Data
  845.     '
  846.     MIDIOutput1.Action = MIDIOUT_SEND
  847.     '
  848.     'Remove the MIDI data from the MIDI IN queue
  849.     '
  850.     MIDIInput1.Action = MIDIIN_REMOVE
  851.     Loop
  852. End Sub
  853.  
  854. Sub MIDIOutput1_Error (ErrorCode As Integer, ErrorMessage As String)
  855.     '
  856.     ' Midi output error, display message
  857.     '
  858.     MsgBox ErrorMessage
  859. End Sub
  860.  
  861. Sub MIDIOutput1_QueueEmpty ()
  862.     '
  863.     'Once queue becomes empty, get ready to record again
  864.     '
  865.     MIDIOutput1.Action = MIDIOUT_STOP
  866. End Sub
  867.  
  868.